var server = require("./server");
var router = require("./router");
var file = require("./file.js");
var redirect = {};
var post = require("./DAL/Post.js");

redirect["/"] = function (callback){
	file.read("./public/html/main.html", function(fileContent) {
		var data = new Object();
		data.content = fileContent;
		data.type = "html";
		callback(false, data);
	});
};
redirect["/post"] = function (callback){
	var data = new Object();
	post.getList(function(postData){
		data.content = JSON.stringify(postData);
		data.type = "plain";
		callback(false, data);
	});
};


server.start(router.route, redirect);
